function onBridgeReady() {
	if (WeixinJSBridge) {
		WeixinJSBridge.call('hideOptionMenu');
	}
}

if (typeof WeixinJSBridge == "undefined") {
	if (document.addEventListener) {
		document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
	} else if (document.attachEvent) {
		document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
		document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
	}
} else {
	onBridgeReady();
}

var Details = {
	config : {},
	file : [],
	area : 0,
	order_type : 0,
	init : function(config) {
		var _this = this;
		$.extend(_this.config, config);
		_this.init_btn();
	},
	init_btn : function() {
		var _this = this;
		$("#review").on("click", function() {
			$.get(_this.config.review, function(_dat) {
				if (_dat.status) {
					location.reload();
				} else {
					tips(_dat.info);
				}
			});
		});
		$("#chat").on("click", function() {
			$.get(_this.config.chat, function(_dat) {
				if (_dat.status) {
					tips("您现在可以直接在聊天框中输入文字消息发送给对方!", function() {
						if (WeixinJSBridge) {
							WeixinJSBridge.invoke('closeWindow');
						} else {
							window.close();
						}
					});
				} else {
					tips(_dat.info);
				}
			});
		});
	}
}